package ru.pb.game.data.xml.holders;

import java.util.ArrayList;
import java.util.List;

import ru.pb.global.network.IPRange;
import ru.pb.global.xml.holder.AbstractHolder;

/**
 * @author Felixx
 */
public final class IPSystemHolder extends AbstractHolder
{
	private static IPSystemHolder _instance;
	private final List<IPRange> _list = new ArrayList<IPRange>(2);

	public static IPSystemHolder getInstance()
	{
		if(_instance == null)
		{
			_instance = new IPSystemHolder();
		}
		return _instance;
	}

	@Override
	public int size()
	{
		return _list.size();
	}

	@Override
	public void clear()
	{
		_list.clear();
	}

	@Override
	public void log()
	{
		info("load " + size() + " ip ranges.");
	}

	public List<IPRange> get()
	{
		return _list;
	}

	public void add(IPRange ipRange)
	{
		_list.add(ipRange);
	}
}